home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 97 / CD-ROM 97 / CD-ROM 97.iso / internet / ghostzilla / ghsetup.exe / chrome / comm.jar / content / wallet / walletTasksOverlay.xul < prev   
Encoding:
Extensible Markup Language  |  2002-04-09  |  6.1 KB  |  172 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!--
  4.    The contents of this file are subject to the Netscape Public
  5.    License Version 1.1 (the "License"); you may not use this file
  6.    except in compliance with the License. You may obtain a copy of
  7.    the License at http://www.mozilla.org/NPL/
  8.     
  9.    Software distributed under the License is distributed on an "AS
  10.    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  11.    implied. See the License for the specific language governing
  12.    rights and limitations under the License.
  13.     
  14.    The Original Code is Mozilla Communicator client code, released
  15.    March 31, 1998.
  16.    
  17.    The Initial Developer of the Original Code is Netscape
  18.    Communications Corporation. Portions created by Netscape are
  19.    Copyright (C) 1998-1999 Netscape Communications Corporation. All
  20.    Rights Reserved.
  21.    
  22.    Contributor(s): 
  23.   -->
  24.  
  25. <!DOCTYPE window SYSTEM "chrome://wallet/locale/walletTasksOverlay.dtd">
  26.  
  27. <overlay id="walletTasksOverlay"
  28.          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  29.  
  30.   <script type="application/x-javascript" src="chrome://wallet/content/walletOverlay.js"/>
  31.  
  32.   <script type="application/x-javascript">
  33.   <![CDATA[
  34.  
  35.     function CheckForEncrypt() {
  36.       // remove either encrypt or obscure depending on pref setting
  37.       var elementOn, elementOff;
  38.       var pref;
  39.       pref = Components.classes['@mozilla.org/preferences-service;1'];
  40.       pref = pref.getService();
  41.       pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
  42.       try {
  43.         if (pref.getBoolPref("wallet.crypto")) {
  44.           elementOn = document.getElementById("obscure");
  45.           elementOff = document.getElementById("encrypt");
  46.         } else {
  47.           elementOn = document.getElementById("encrypt");
  48.           elementOff = document.getElementById("obscure");
  49.         }
  50.         elementOn.setAttribute("disabled","false");
  51.         elementOff.setAttribute("disabled","true");
  52.       } catch(e) {
  53.         var encrypt = document.getElementById("encrypt");
  54.         if(encrypt) {
  55.           encrypt.setAttribute("disabled", "true");
  56.         }
  57.         var obscure = document.getElementById("obscure");
  58.         if(obscure) {
  59.           obscure.setAttribute("disabled", "true");
  60.         }
  61.         dump("wallet.crypto pref is missing from all.js\n");
  62.       }
  63.     }
  64.  
  65.     // perform a wallet action
  66.     function WalletAction( action ) {
  67.       var wallet = Components.classes['@mozilla.org/wallet/wallet-service;1'];
  68.       wallet = wallet.getService();
  69.       wallet = wallet.QueryInterface(Components.interfaces.nsIWalletService);
  70.       var strings = document.getElementById("menu_passwordManager");
  71.  
  72.       var pref;
  73.       pref = Components.classes['@mozilla.org/preferences-service;1'];
  74.       pref = pref.getService();
  75.       pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
  76.  
  77.       switch( action ) {
  78.         case "password":
  79.           if (!wallet.WALLET_ChangePassword()) {
  80.             window.alert(strings.getAttribute("PasswordNotChanged"));
  81.           }
  82.           break;
  83.         case "expire":
  84.           if (wallet.WALLET_ExpirePassword()) {
  85.             window.alert(strings.getAttribute("PasswordExpired"));
  86.           } else {
  87.             window.alert(strings.getAttribute("PasswordNotExpired"));
  88.           }
  89.           break;
  90.         case "clear":
  91.  
  92.           var pipNSSBundle = document.getElementById("bundle_pipnss");
  93.           var tokenName = pipNSSBundle.getString("InternalToken");
  94.           window.open("chrome://pippki/content/resetpassword.xul",
  95.                       tokenName,
  96.                       "centerscreen,chrome,resizable=1,modal=1,dialog=1");
  97.           break;
  98.         case "encrypt":
  99.           if (pref) {
  100.             wallet.WALLET_InitReencryptCallback(window._content);
  101.             pref.setBoolPref("wallet.crypto", true);
  102.           }
  103.           break;
  104.         case "obscure":
  105.           if (pref) {
  106.             wallet.WALLET_InitReencryptCallback(window._content);
  107.             pref.setBoolPref("wallet.crypto", false);
  108.           }
  109.           break;
  110. /*
  111.         case "safefill":
  112.           formPrefill();
  113.           break;
  114.         case "quickfill": 
  115.           formQuickPrefill();
  116.           break;
  117.         case "capture":
  118.           formCapture();
  119.           walletService.WALLET_RequestToCapture(window._content);
  120.           break;
  121. */
  122.         default:
  123.           break;
  124.       }
  125.     }  
  126.   ]]>
  127.   </script>         
  128.  
  129.   <!-- tasksOverlay menu items -->
  130.   <menupopup id="taskPopup">
  131.     <menu id="menu_passwordManager"
  132.           insertafter="search"
  133.           label="&walletPasswordManager.label;"
  134.           accesskey="&walletPasswordManager.accesskey;"
  135.           PasswordNotChanged = "&PasswordNotChanged;"
  136.           PasswordExpired = "&PasswordExpired;"
  137.           PasswordNotExpired = "&PasswordNotExpired;">
  138.       <menupopup onpopupshowing="CheckForEncrypt()">
  139.         <menuitem label="&walletDisplaySignonsCmd.label;"
  140.                   accesskey="&walletDisplaySignonsCmd.accesskey;"
  141.                   oncommand="WalletDialog('signon');"/> 
  142.         <menuitem label="&walletChangePasswordCmd.label;"
  143.                   accesskey="&walletChangePasswordCmd.accesskey;"
  144.                   oncommand="WalletAction('password');"/>
  145.         <menuitem label="&walletExpirePasswordCmd.label;"
  146.                   accesskey="&walletExpirePasswordCmd.accesskey;"
  147.                   oncommand="WalletAction('expire');"/>
  148.         <menuseparator/>
  149.         <menuitem label="&walletEncryptCmd.label;"
  150.                   id="encrypt"
  151.                   accesskey="&walletEncryptCmd.accesskey;" 
  152.                   oncommand="WalletAction('encrypt');"/>
  153.         <menuitem label="&walletObscureCmd.label;"
  154.                   id="obscure"
  155.                   accesskey="&walletObscureCmd.accesskey;" 
  156.                   oncommand="WalletAction('obscure');"/>
  157.         <menuitem label="&walletClearCmd.label;"
  158.                   id="clear"
  159.                   accesskey="&walletClearCmd.accesskey;" 
  160.                   oncommand="WalletAction('clear');"/>
  161.       </menupopup>
  162.     </menu>
  163.   </menupopup>
  164.  
  165.   <stringbundleset id="stringbundleset">
  166.     <stringbundle id="bundle_pipnss"
  167.                   src="chrome://pipnss/locale/pipnss.properties"/>
  168.   </stringbundleset>
  169.  
  170.  
  171. </overlay>
  172.